import { rtkApi } from '@shared/api'
import { UserSettings } from '../ui/UserSettingsPage/UserSettingsPage'

export const registerApi = rtkApi.injectEndpoints({
  endpoints: (build) => ({
    updateUser: build.mutation<void, UserSettings & { id: string }>({
      query: (user) => ({
        body: user,
        method: 'POST',
        url: '/users/update',
      }),
    }),
  }),
})

export const { useUpdateUserMutation } = registerApi
